<template>
	<view class='container'>

		<view v-for="(item,index) in list.records" :key="index" class="shop_child" @click="defails(item)">
			<view class="view_img">
				<image :src="item.pic" mode=""></image>
			</view>
			<view class="shop_title">
				{{item.shopName}}
			</view>
			<view class="red_money">￥<text>{{item.price}}</text></view>
		</view>
		<view v-if="!list.records.length" class="empty-list">
			暂无商品
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: {}
			}
		},
		methods: {

			get_list() {
				uni.request({
					url: "https://yami-mini-api.yiluxdeng.com/prod/moreBuyProdList?current=1&size=10",
					method: "get",
					dataType: "json",
					success: (res) => {
						this.list = res.data
					}
				})
			},
			defails(item) {
				console.log(item);
				uni.navigateTo({
					url: "/pages/component/details/details?item=" + encodeURIComponent(JSON.stringify(item.prodId))
				})
			},

		},
		onLoad() {
			this.get_list()
		}
	}
</script>

<style>
	.view_img {
		width: 100%;
		height: 50vw
	}

	.view_img>image {
		width: 100%;
		height: 100%;
	}

	.shop_child {
		background: white;
		margin-top: 10px;
		width: 45%;
	}

	.shop_title {
		margin-top: 10px;
	}

	.red_money {
		margin-top: 10px;
		color: red;
		margin-bottom: 10px;
	}

	.container {
		width: 100%;
		display: flex;
		justify-content: space-around;
		flex-direction: row;
		flex-wrap: wrap;
	}
</style>
